package com.uzai.console.web.mini;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSort;
import com.uzai.console.annotation.SystemLogType;
import com.uzai.console.dto.BaseDto;
import com.uzai.console.dto.mini.base.MiniPageConfigDto;
import com.uzai.console.enums.OperationTypeEnum;
import com.uzai.console.enums.SystemModelEnum;
import com.uzai.console.service.mini.MiniBaseService;
import com.uzai.console.vo.mini.base.MiniPageConfigVo;
import com.uzai.console.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * 微信小程序|基础设置
 * @author liuqi
 * @date 2021年08月16日 15:11
 */
@Api(value = "基础设置",tags = "微信小程序|基础设置")
@ApiSort(7)
@RestController
public class MiniBaseController extends BaseController {
    private Logger logger = LoggerFactory.getLogger(MiniBaseController.class);

    @Autowired
    private MiniBaseService miniBaseService;

    @ApiOperation(value = "查询微信小程序页面设置信息", notes = "查询微信小程序页面设置信息", response = MiniPageConfigVo.class)
    @ApiOperationSupport(order = 1)
    @PostMapping("/miniBase/pageConfig/find")
    public Object findMiniPageConfig(@RequestBody BaseDto baseDto){
        return miniBaseService.findMiniPageConfig(baseDto);
    }

    @SystemLogType(model = SystemModelEnum.MiniPageConfig, type = OperationTypeEnum.UPDATE)
    @ApiOperation(value = "保存微信小程序页面设置信息", notes = "保存微信小程序页面设置信息",response = Boolean.class)
    @ApiOperationSupport(order = 2)
    @PostMapping("/miniBase/pageConfig/update")
    public Object updateMiniPageConfig(@RequestBody MiniPageConfigDto miniPageConfigDto){
        miniBaseService.updateMiniPageConfig(miniPageConfigDto);
        return true;
    }

}
